Telegram Group & Telegram Channel
⚡️ Фича дня: условный оператор с инициализацией

Часто перед условным оператором нужно объявить временную переменную, что загромождает область видимости и увеличивает вероятность ошибок.

Инициализация переменных прямо в условии if/switch (C++17) позволяет ограничить область видимости только блоком условия.

🔴 До:
auto it = map.find(key);
if (it != map.end()) {
// Используем it->second
}


🟢 После:
if (auto it = map.find(key); it != map.end()) {
// Используем it->second
}


Примеры использования:

- Поиск в контейнерах с проверкой результата
- Вызов функций с проверкой возвращаемого значения
- Инициализация мьютексов с последующей блокировкой

💡 Как думаете, улучшает ли это читаемость кода?

Библиотека C/C++ разработчика #буст



tg-me.com/cppproglib/5674
Create:
Last Update:

⚡️ Фича дня: условный оператор с инициализацией

Часто перед условным оператором нужно объявить временную переменную, что загромождает область видимости и увеличивает вероятность ошибок.

Инициализация переменных прямо в условии if/switch (C++17) позволяет ограничить область видимости только блоком условия.

🔴 До:

auto it = map.find(key);
if (it != map.end()) {
// Используем it->second
}


🟢 После:
if (auto it = map.find(key); it != map.end()) {
// Используем it->second
}


Примеры использования:

- Поиск в контейнерах с проверкой результата
- Вызов функций с проверкой возвращаемого значения
- Инициализация мьютексов с последующей блокировкой

💡 Как думаете, улучшает ли это читаемость кода?

Библиотека C/C++ разработчика #буст

BY Библиотека C/C++ разработчика | cpp, boost, qt


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/cppproglib/5674

View MORE
Open in Telegram


Библиотека C C разработчика | cpp boost qt Telegram | DID YOU KNOW?

Date: |

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

Among the actives, Ascendas REIT sank 0.64 percent, while CapitaLand Integrated Commercial Trust plummeted 1.42 percent, City Developments plunged 1.12 percent, Dairy Farm International tumbled 0.86 percent, DBS Group skidded 0.68 percent, Genting Singapore retreated 0.67 percent, Hongkong Land climbed 1.30 percent, Mapletree Commercial Trust lost 0.47 percent, Mapletree Logistics Trust tanked 0.95 percent, Oversea-Chinese Banking Corporation dropped 0.61 percent, SATS rose 0.24 percent, SembCorp Industries shed 0.54 percent, Singapore Airlines surrendered 0.79 percent, Singapore Exchange slid 0.30 percent, Singapore Press Holdings declined 1.03 percent, Singapore Technologies Engineering dipped 0.26 percent, SingTel advanced 0.81 percent, United Overseas Bank fell 0.39 percent, Wilmar International eased 0.24 percent, Yangzijiang Shipbuilding jumped 1.42 percent and Keppel Corp, Thai Beverage, CapitaLand and Comfort DelGro were unchanged.

Библиотека C C разработчика | cpp boost qt from es


Telegram Библиотека C/C++ разработчика | cpp, boost, qt
FROM USA